home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cujoct93.zip / 1110088C < prev    next >
Text File  |  1993-08-10  |  577b  |  29 lines

  1. /* clock.c: IBM PC Clock tick functions */
  2.  
  3. #include <dos.h>
  4.  
  5. /* Pointer to the clock tick */
  6. static volatile unsigned long far *tptr = MK_FP(0,0x46c);
  7.  
  8. static unsigned long start = 0L;
  9.  
  10. /* clock_reset: Resets the timer */
  11. void clock_reset(void)
  12. {
  13.     start = *tptr;
  14. }
  15.  
  16. /* clock_wait: Waits a certain number of ticks */
  17. void clock_wait(unsigned long n)
  18. {
  19.     start = *tptr;
  20.     while ((*tptr - start) < n)
  21.         ;
  22. }
  23.  
  24. /* clock_elapsed: Returns the number of ticks since last reset */
  25. unsigned long clock_elapsed(void)
  26. {
  27.     return *tptr - start;
  28. }
  29.